package com.zmx.b2c.order.repository;

import com.zmx.b2c.order.entity.B2COrder;
import com.zmx.common.common.repository.BaseRepository;
import org.springframework.data.jpa.repository.Query;

/**
@author zhaomxr
*/
public interface B2COrderRepository extends BaseRepository<B2COrder>{

    String base_column_list = "id, active_id, member_id, parent_sn, order_sn, out_sn, delivery_no, order_status, payment_status, delivery_status, platform, order_source, consignee, phone, address, area, amount_paid, freight, total_price, leave_word, creator, create_time, modifier, modify_time, ts, dr";

    B2COrder findByOrderSn(String sn);

    @Query(value = "SELECT COUNT(1) FROM jx_order where member_id = ?1 and create_time > DATE_SUB(now(),INTERVAL -1 DAY);",nativeQuery = true)
    int getOrderCountByMemberIdAndHalfHour(String memberId);
}
